<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>个人空间管理</title>

  <link rel="shortcut icon" th:href="@{/images/favicon.ico}" />
  <link rel="stylesheet" href="../../static/lib/Semantic-UI/semantic.min.css" th:href="@{/lib/Semantic-UI/semantic.min.css}">
  <link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}">
</head>
<body>

<!--导航栏-->
<nav class="ui inverted gird-header" >
  <div class="ui container">
    <div class="ui inverted secondary stackable menu">
      <h2 class="ui olive header item" style="font-family: STSong"><span th:text="${session.user.username}">SUOYUEの</span>の创作中心</h2>
      <a href="#" th:href="@{/user/user}" class="m-item active item m-mobile-hide"><i class="home icon"></i>个人中心</a>
      <a href="#" th:href="@{/user/blogs}" class="m-item item m-mobile-hide"><i class="map icon"></i>文章管理</a>
      <a href="#" th:href="@{/user/types}" class="m-item item m-mobile-hide"><i class="clone outline icon"></i>分类管理</a>
      <a href="#" th:href="@{/user/images}" class="m-item item m-mobile-hide"><i class="images icon"></i>图片管理</a>
      <div class="right m-item m-mobile-hide menu">
        <div class="ui dropdown item">
          <div class="text">
            <img class="ui avatar image" src="../../static/images/me.jpg" th:src="${user.avatar}">
          </div>
          <i class="dropdown icon"></i>
          <div class="menu">
            <a href="" th:href="@{/logout}" class="item">注销</a>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!--手机端收起导航栏-->
  <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show">
    <i class="sidebar icon"></i>
  </a>
</nav>

<div class="m-padded-tb-hugex"></div>

  <!--中间内容-->
  <div  class="m-container-small m-padded-tb-massive">
    <div class="ui container">
      <form action="#" method="post" th:action="@{/user/updateUserInfo}" class="ui form" enctype="multipart/form-data">
        <div class="field">
          <div class="m-margin-">
            <img class="ui centered circular image" align="center" src="../../static/images/me.jpg" th:src="${user.avatar}" style="width: 150px;height: 150px;">
          </div>

          <div class="ui mini negative message" th:unless="${#strings.isEmpty(message)}" th:text="${message}">提示：图片上传/失败</div>
          <div class="ui left labeled input m-margin-top">
            <label class="ui teal basic label">上传头像</label>
            <input type="file" name="file" placeholder="请选择上传要更改的头像..." accept="image/*">
          </div>

          <div class="ui left labeled input m-margin-top">
            <label class="ui teal basic label">修改昵称</label>
            <input type="text" name="username" placeholder="用户名..." th:value="${user.username}">
          </div>
          <div class="ui left labeled input m-margin-top">
            <label class="ui teal basic label">重置密码</label>
            <input type="password" name="password" placeholder="填写才会重置...">
          </div>
        </div>
        <div class="ui error message"></div>
        <div class="ui right aligned container">
          <button type="button" class="ui button" onclick="window.history.go(-1)" >返回</button>
          <button class="ui teal submit button">提交</button>
        </div>
      </form>
    </div>
  </div>

  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>

  <!--底部栏-->
  <footer class="ui inverted vertical segment m-padded-tb-massive m-opacity" th:replace="_fragments :: footer">
  </footer>

  <script src="../../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
  <script src="../../static/lib/Semantic-UI/semantic.min.js" th:src="@{/lib/Semantic-UI/semantic.min.js}"></script>

  <script>

    $('.menu.toggle').click(function () {
      $('.m-item').toggleClass('m-mobile-hide');
    });

    $('.ui.dropdown').dropdown({
      on : 'hover'
    });

    // $('.ui.form').form({
    //   fields : {
    //     title : {
    //       identifier: 'file',
    //       rules: [{
    //         type : 'empty',
    //         prompt: '请先选择上传图片'
    //       }]
    //     }
    //   }
    // });

  </script>

</body>
</html>